<template>
	<el-container>
		<el-header style="height: auto;">
			<sc-select-filter :data="filterData" :label-width="80" @on-change="filterChange"></sc-select-filter>
		</el-header>
		<el-header>
			<div class="left-panel">
			</div>
			<div class="left-panel"> </div>
			<div class="right-panel">
				<el-form-item label="被评价者" style="padding-top: 20px;">
					<select-hr-user-dialog v-model:userId="search.userId" :mode="false"/>
				</el-form-item>
				<div class="right-panel-search">
					<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
				</div>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="recordId" @selection-change="selectionChange" stripe remoteSort remoteFilter>
				<el-table-column label="#" type="index" width="50"></el-table-column>
				<el-table-column label="人员姓名" prop="userName" width="100" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="工作态度" prop="attitudeLevel" width="150">
					<template #default="scope">
						{{scope.row.attitudeLevel}}/分
					</template>
				</el-table-column>
				<el-table-column label="学习能力" prop="learnLevel" width="150">
					<template #default="scope">
						{{scope.row.learnLevel}}/分
					</template>
				</el-table-column>
				<el-table-column label="工作持能" prop="skillLevel" width="150">
					<template #default="scope">
						{{scope.row.skillLevel}}/分
					</template>
				</el-table-column>
				<el-table-column label="备注说明" prop="remark" width="300" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="100">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
	<recordDetails v-if="dialog.detailsSave" ref="detailsDialog" @closed="dialog.detailsSave=false"></recordDetails>
</template>

<script>
import selectHrUserDialog from "@/views/module/selectHrUserDialog";
import scSelectFilter from '@/components/scSelectFilter'
import recordDetails from './details'
export default {
	name: 'Hr Evaluate Manage',
	components: {
		scSelectFilter,
		recordDetails,
		selectHrUserDialog
	},
	data() {
		return {
			dialog: {
				detailsSave:false,
			},
			filterData: [
				{
					title: "日期范围",
					key: "date",
					multiple: false,
					options: [
						{
							label: "全部",
							value: ""
						},
						{
							label: "今日",
							value: "1"
						},
						{
							label: "昨日",
							value: "2"
						},
						{
							label: "一周内",
							value: "3"
						},
						{
							label: "一月内",
							value: "4"
						},
						{
							label: "一月前",
							value: "5"
						}
					]
				},
				{
					title: "综合评价",
					key: "status",
					multiple: false,
					options:[{
						label: "全部",
						value: ""
					}]
				}
			],

			apiObj: this.$API.hr.hrEvaluate.getHrEvaluateQueryList,
			search: {
				date:'',
				status:'',
			}
		}
	},
	mounted() {
		this.getSysDicByCode();
	},
	methods: {
		async getSysDicByCode()
		{
			var res = await this.$API.hr.hrDic.getHrDicByCode.get({code:'evaluateStatus'});
			if (res.code == 200) {
				this.filterData[1].options=this.filterData[1].options.concat(res.data);
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		filterChange(data){
			this.search.date = data.date;
			this.search.status = data.status;
			this.$refs.table.upData(this.search)
		},
		//查看
		table_show(row) {
			this.dialog.detailsSave = true
			this.$nextTick(() => {
				this.$refs.detailsDialog.open().setData(row)
			})
		},
		//搜索
		async upsearch() {
			this.$refs.table.upData(this.search)
		},
		//本地更新数据
		handleSaveSuccess() {
			this.$refs.table.refresh()
		}
	}
}
</script>

<style>
</style>
